/*
 * Copyright (c) 2014 laidian. All Rights Reserved.
 * 
 * @author yaoyuming
 * 
 * @date 2020/9/1 0001
 */
package com.yao.auth.config;

import cn.hutool.core.util.StrUtil;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * spring security 自定义配置
 * 
 * @author yaoyuming
 * @date 2020/9/1 0001 16:03
 */
@ConfigurationProperties(prefix = "security")
@Data
@Component
public class CustomSecurityProperties {

    /**
     * 首页地址，登陆成功，默认为index.html
     */
    private String homePage = "index";

    /**
     * 登陆页，默认为login.html
     */
    private String loginPage = "login";

    /**
     * 登陆失败页面，默认为error.html
     */
    private String failurePage = "error";


    public String getLoginPage() {
        if (StrUtil.startWith(loginPage, StrUtil.SLASH)) {
            return loginPage;
        }else{
            return StrUtil.concat(true,StrUtil.SLASH, loginPage);
        }
    }
}